import axios from 'axios'

// import axios from 'axios'
export default {
  namespaced: true,
  state: {
    Token: localStorage.getItem('token') ? localStorage.getItem('token') : '',
    // Token: '',
    userInfo: {}
  },
  mutations: {
    updateToken(state, payload) {
      state.Token = payload
      localStorage.setItem('token', payload)
    },
    updataUserInfo(state, info) {
      state.userInfo = info
    }
  },
  getters: {},
  actions: {
    async getUserInfo(content) {
      // console.log(content)
      const { data: res } = await axios.get('/my/userinfo')
      // console.log(res)
      if (res.code !== 0) return
      content.commit('updataUserInfo', res.data)
    }
  },
  modules: {}

}
